import java.util.Objects;

public class User {
    private Integer id;
    private String name;
    private String password;
    private String role;
    public User(Integer id, String name, String password, String role) {
        this.id = id;
        this.name = name;
        this.password = password;
        this.role = role;
    }
    public User(Integer id, String name, String password) {
        this.id = id;
        this.name = name;
        this.password = password;
        this.role = "admin";
    }

    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getPassword() {
        return password;
    }

    public void setPassword(String password) {
        this.password = password;
    }

    public String getRole() {
        return role;
    }

    public void setRole(String role) {
        this.role = role;
    }


    @Override
    public boolean equals(Object obj) {
        if (this == obj) return true;
        if (obj == null || getClass() != obj.getClass()) return false;
        User f = (User) obj;
        return Objects.equals(this.id, f.id)
                && Objects.equals(this.name, f.name)
                && Objects.equals(this.password, f.password)
                && Objects.equals(this.role, f.role);
    }

    @Override
    public String toString() {
        return String.format("%1$-5s%2$-10s%3$-15s%4$-10s", this.id, this.name, this.password, this.role);
    }
}
